home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Light ROM 1
/
LIGHT-ROM 1 (Amiga Library Services)(1994).iso
/
ffdisks
/
d963.lha
/
SIOD
/
scm
/
bubblesort.scm
< prev
next >
Wrap
Text File
|
1993-02-22
|
630b
|
16 lines
(define (bubble-sort l test)
(let ((changes #t)
(l1 l)
(tmp nil))
(while changes
(set! changes #f)
(while (not (null? (cdr l1)))
(if (test (car l1) (cadr l1))
(begin (set! tmp (car l1))
(set-car! l1 (cadr l1))
(set-car! (cdr l1) tmp)
(set! changes #t)))
(gc)
(set! l1 (cdr l1)))
(set! l1 l))))